package com.fb;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.WindowManager;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.dev.IconViewClose;
import com.dev.MainActivity;
import com.fb.FileBrowserPage;
import java.io.File;
public class BatchRenameFile extends LinearLayout implements OnClickListener {
	WindowManager.LayoutParams wlp=new WindowManager.LayoutParams();
	LinearLayout titlebar;
	LayoutParams titlebarlp;
	LayoutParams itemlp;
	TextView title;
	IconViewClose close;
	MainActivity ma;
	FileBrowserPage.Item it1,it2,it3,it4,it5;
	File[] destination;
	public BatchRenameFile(MainActivity ma){
		super(ma);
		this.ma=ma;
		setOrientation(VERTICAL);
		close=new IconViewClose(ma);
		close.setOnClickListener(this);
		title=new TextView(ma);
		title.setText("批量重命名");
		titlebar=new LinearLayout(ma);
		titlebar.setOrientation(HORIZONTAL);
		titlebar.addView(title,new LayoutParams(0,-1,1f));
		titlebar.addView(close);
		titlebarlp=new LayoutParams(-1,ma.dialogTitleBarHeight);
		itemlp=new LayoutParams(-1,ma.dialogTitleBarHeight);
		it1=new FileBrowserPage.Item(ma);
		it2=new FileBrowserPage.Item(ma);
		it3=new FileBrowserPage.Item(ma);
		it4=new FileBrowserPage.Item(ma);
		it5=new FileBrowserPage.Item(ma);
		it1.setText("修改扩展名");
		it2.setText("原文件名+数字+原扩展名");
		it3.setText("数字+原扩展名");
		it4.setText("添加新扩展名");
		it5.setText("数字");
		it1.setOnClickListener(this);
		it2.setOnClickListener(this);
		it3.setOnClickListener(this);
		it4.setOnClickListener(this);
		it5.setOnClickListener(this);
		addView(titlebar,titlebarlp);
		addView(it1,itemlp);
		addView(it2,itemlp);
		addView(it3,itemlp);
		addView(it4,itemlp);
		addView(it5,itemlp);
	}
	public void show(File[] destination){
		this.destination=destination;
		wlp.width=ma.wp*4/5;
		wlp.height=-2;
		ma.wm.addView(this,wlp);
	}
	void dismiss(){
		ma.wm.removeView(this);
	}
	@Override
	public void onClick(View view) {
		if(view==close){
			dismiss();
		}
	}
}
